package com.satoken.controller;

import cn.dev33.satoken.stp.StpUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/auth")
public class SafeAuthController {

    @GetMapping("/check")
    public boolean check(String name,String pwd){
        if(name.equals("admin") && pwd.equals("123")){
            StpUtil.openSafe(5);//120秒
        }
        return true;
    }

    @GetMapping("/delete")
    public boolean delete(){
        boolean safe = StpUtil.isSafe();
        if(safe){
            return true;
        }
        return false;
    }

}
